package com.wanma.thread;

class Res1 {
	public int count = 0;
}

class ThreadLocala extends Thread {
	private Res1 res;

	public ThreadLocala(Res1 res1) {
		this.res = res1;
	}

	@Override
	public void run() {
		for (int i = 0; i < 3; i++) {
			res.count++;
			System.out.println(Thread.currentThread().getName() + "---------------" + res.count);
		}

	}
}

public class ThreadDemo2 {
	public static void main(String[] args) {
		Res1 res = new Res1();
		ThreadLocala locala = new ThreadLocala(res);
		ThreadLocala locala1 = new ThreadLocala(res);
		ThreadLocala locala2 = new ThreadLocala(res);
		locala.start();
		locala1.start();
		locala2.start();
	}
}
